Ideas:
| Plant | Flowers | Date | lon | lat | ele | Month | Year | julian |
|---|---|---|---|---|---|---|---|---|
| Glossoloma oblongicalyx | 4 | 2015-10-19 | -78.59093 | 0.130838 | 2270 | October | 2015 | 292 |
| Gasteranthus quitensis | 2 | 2016-10-17 | -78.59770 | 0.120070 | 1940 | October | 2016 | 291 |
| Kohleria affinis | 1 | 2016-12-13 | -78.59534 | 0.126746 | 2110 | December | 2016 | 348 |
| Columnea ciliata | 3 | 2014-02-27 | -78.59934 | 0.116682 | 1960 | February | 2014 | 58 |
| Columnea medicinalis | 1 | 2014-04-23 | -78.59372 | 0.128700 | 2130 | April | 2014 | 113 |
| Drymonia teuscheri | 3 | 2016-07-28 | -78.59245 | 0.129393 | 2200 | July | 2016 | 210 |
As range
Equal probability of flowering at anytime.
## sink("model/threshold_baseline.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- alpha[Plant[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<-alpha[PredPlant[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - prediction[x])
## }
##
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
##
## #Intercept flowering probability
## alpha[j] ~ dnorm(0,0.386)
##
## }
##
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2548
## Unobserved stochastic nodes: 3164
## Total graph size: 15848
##
## Initializing model
## sink("model/threshold_attraction.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- e[Plant[x],Site[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<- e[NewPlant[x],NewSite[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - prediction[x])
## }
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #########################
## #autocorrelation in error
## #########################
##
## #For each of observation
## for(x in 1:Sites){
## e[1:Plants,x] ~ dmnorm(zeros,tauC[,])
## }
##
## ##covariance among similiar species
## for(i in 1:Plants){
## for(j in 1:Plants){
## C[i,j] = exp(-lambda_cov * D[i,j])
## }
## }
##
## ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
## vCov = omega*C[,] + (1-omega) * I
## tauC=inverse(vCov*gamma)
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
##
## #Intercept flowering probability
## alpha[j] ~ dnorm(0,0.386)
##
## }
## #Autocorrelation priors
## gamma = 1
##
## #Strength of covariance decay
## lambda_cov = 1
## omega ~ dunif(0,1)
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2548
## Unobserved stochastic nodes: 3171
## Total graph size: 19809
##
## Initializing model
## sink("model/threshold_repulsion.jags")
## cat("
## model {
##
## for (x in 1:Nobs){
##
## #Observation of a flowering plant
## Y[x] ~ dbern(p[x])
## logit(p[x]) <- e[Plant[x],Site[x]]
##
## #Residuals
## discrepancy[x] <- abs(Y[x] - p[x])
##
## #Assess Model Fit
## Ynew[x] ~ dbern(p[x])
## discrepancy.new[x]<-abs(Ynew[x] - p[x])
## }
##
##
## #Sum discrepancy
## fit<-sum(discrepancy)/Nobs
## fitnew<-sum(discrepancy.new)/Nobs
##
## #Prediction
##
## for(x in 1:Npreds){
## #predict value
##
## #Observation - probability of flowering
## prediction[x] ~ dbern(p_new[x])
## logit(p_new[x])<- e[NewPlant[x],NewSite[x]]
##
## #predictive error
## pred_error[x] <- abs(Ypred[x] - prediction[x])
## }
##
## #Predictive Error
## fitpred<-sum(pred_error)/Npreds
##
## #########################
## #autocorrelation in error
## #########################
##
## #For each of observation
## for(x in 1:Sites){
## e[1:Plants,x] ~ dmnorm(zeros,tauC[,])
## }
##
## ##covariance among similiar species
## for(i in 1:Plants){
## for(j in 1:Plants){
## C[i,j] = exp(-lambda_cov * D[i,j])
## }
## }
##
## ## Covert variance to precision for each parameter, allow omega to shrink to identity matrix
## vCov = omega*C[,] + (1-omega) * I
## tauC=vCov*gamma
##
## #Priors
##
## #Species level priors
##
## for (j in 1:Plants){
##
## #Intercept flowering probability
## alpha[j] ~ dnorm(0,0.386)
##
## }
## #Autocorrelation priors
## gamma = 3
##
## #Strength of covariance decay
## lambda_cov = 1
## omega ~ dunif(0,1)
## }
## ",fill=TRUE)
##
## sink()
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 2548
## Unobserved stochastic nodes: 3171
## Total graph size: 19809
##
## Initializing model